import request from '@/utils/request'

const apiName = '/system/rbac'

export function login(data) {
  return request({
    url: `${apiName}/login`,
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: `${apiName}/getInfo`,
    method: 'get',
    params: {
      token
    }
  })
}

export function getPermission(token) {
  return request({
    url: `${apiName}/getPermission`,
    method: 'get',
    params: {
      token
    }
  })
}

export function logout() {
  return request({
    url: `${apiName}/logout`,
    method: 'post'
  })
}

export function generateValidateCode(validateCodeId) {
  return request({
    url: `${apiName}/generateValidateCode`,
    method: 'Get',
    params: {
      validateCodeId: validateCodeId
    }
  })
}

export function sendEmailValidateCode(params) {
  return request({
    url: `${apiName}/sendEmailValidateCode`,
    method: 'Get',
    params
  })
}

export function findPassword(params) {
  return request({
    url: `${apiName}/findPassword`,
    method: 'Get',
    params
  })
}

export function resetPassword(params) {
  return request({
    url: `${apiName}/resetPassword`,
    method: 'Get',
    params
  })
}

export function modifyPassword(params) {
  return request({
    url: `${apiName}/modifyPassword`,
    method: 'Get',
    params
  })
}
